package top.buluoluo.productservice.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.buluoluo.commoncore.domain.response.Result;
import top.buluoluo.productservice.dto.request.SpuPageRequest;
import top.buluoluo.productservice.dto.response.DiscountDTO;
import top.buluoluo.productservice.dto.response.SpuDTO;
import top.buluoluo.productservice.dto.result.PageResult;
import top.buluoluo.productservice.service.ProductService;

@RestController
@Tag(name = "商品折扣管理", description = "商品折扣相关的接口")
public class DiscountController {
    @Autowired
    private ProductService productService;
    @Operation(summary = "获取具体折扣信息", description = "根据折扣id获取折扣信息")
    @GetMapping("/discount/getDiscountById/{discountId}")
    public Result<DiscountDTO> getDiscountById(@PathVariable Long discountId ) {
        return productService.getDiscountById(discountId);
    }
    @Operation(summary = "获取某折扣是否合法的结果", description = "根据折扣id获取折扣信息获取一个布尔值")
    @GetMapping("/discount/checkDiscountValid/{discountId}")
    public Result<Boolean> checkDiscountValid(@PathVariable Long discountId ) {
        return productService.checkDiscountValid(discountId);
    }
}
